package com.company.project.common.utils;


import lombok.extern.slf4j.Slf4j;

@Slf4j
public class IpSearchUtils {

    public static String ipConfigUrl = "https://whois.pconline.com.cn/ipJson.jsp";

    public static String getIpInfo(String ipUrl){
        String tokenJson = OkHttpUtils.builder()
                .url(ipConfigUrl)
                .addParam("ip", ipUrl)
                .addParam("json", "true")
                .post(false)
                .sync();
        return tokenJson;
    }

    public static void main(String[] args) throws InterruptedException {
        log.info(IpSearchUtils.getIpInfo("223.101.102.146"));
        Thread.sleep(1000);
        log.info(IpSearchUtils.getIpInfo("39.144.41.23"));
        Thread.sleep(1000);
        log.info(IpSearchUtils.getIpInfo("47.104.203.149"));
    }
}
